using UseCaseManager.BO;

namespace UseCaseManager.Test.BO
{
    public class TestUtilsProject
    {
        /// <summary>
        /// Creates a new saved Project with a random value assigned to every property
        /// </summary>
        public static Project CreateSavedProject()
        {
            Project project = CreateUnsavedValidProject();
            project.Save();
            return project;
        }

        /// <summary>
        /// Creates a new unsaved Project with a random value assigned to every property
        /// </summary>
        public static Project CreateUnsavedValidProject()
        {
            Project project = new Project();
            project.ProjectName = TestUtils.GetRandomString();
            project.Customer = TestUtils.GetRandomString();
            return project;
        }
	    
        /// <summary>
        /// Creates a new unsaved Project where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static Project CreateUnsavedDefaultProject()
        {
            Project project = new Project();
            return project;
        }
        /// <summary>
        /// Creates a project with 2 releases and 5 drops. Assigned and Baseline points are set.
        /// </summary>
        public static Project GetComplexSavedProject()
        {
            Project project = CreateUnsavedValidProject();
            Drop drop1;
            Drop drop2;
            Drop drop3;
            Drop drop4;
            Drop drop5;
            Release release1 = TestUtilsRelease.CreateUnsavedRelease2DropsOrderdByEndDate(out drop1, out drop2);
            Release release2 =
                TestUtilsRelease.CreateUnsavedRelease3DropsOrderdByEndDate(out drop3, out drop4, out drop5);
            project.Releases.Add(release1);
            project.Releases.Add(release2);
            project.Save();
            return project;
        }
    }
}